﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Car_info : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        object Cnum = Server.UrlDecode(Request.QueryString["Cnum"]);
        if (Cnum != null)
        {
            Session["Cnum"] = Cnum.ToString().Trim();
        }
    }

        public object[] GetPrice()//价格 优缺点信息
        {
            ArrayList ary = new ArrayList();
            string sql = "select * from car where type='" + Session["Cnum"] + "'";
            SqlDataReader dr=null;
            SqlConnection conn=new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);
            try
            {
                dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql);
                if (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        ary.Add(dr[i].ToString().Trim());
                    }
                }
                else
                {
                    for(int K=0;K<15;K++)
                    {
                        ary.Add("");
                    }
                }
            }
            catch
            {
                for (int K = 0; K < 15; K++)
                {
                    ary.Add("");
                }
            }
            return ary.ToArray();
        }


    public object[] GetBaseInfo()//基本信息
        {
            ArrayList ary = new ArrayList();
            string sql = "select * from car where type='" + Session["Cnum"] + "'";
            SqlDataReader dr = null;
            SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);
            try
            {
                dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql);
                if (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        ary.Add(dr[i].ToString().Trim());
                    }
                }
                else
                {
                    for(int K=0;K<15;K++)
                    {
                        ary.Add("");
                    }
                }
            }
            catch
            {
                for (int K = 0; K < 15; K++)
                {
                    ary.Add("");
                }
            }
            return ary.ToArray();
        }


    public object[] GetBodyinfo()//车身信息
        {
            ArrayList ary = new ArrayList();
            string sql = "select * from car where Cnum='" + Session["Cnum"] + "'";
            SqlDataReader dr = null;
            SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);
            try
            {
                dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql);
                if (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        ary.Add(dr[i].ToString().Trim());
                    }
                }
                else
                {
                      for(int K=0;K<15;K++)
                    {
                        ary.Add("");
                    }
                }
            }
            catch
            {
                for (int K = 0; K < 15; K++)
                {
                    ary.Add("");
                }
            }
            return ary.ToArray();
        }


    public object[] GetFDJinfo()//汽车发送机信息
        {
            ArrayList ary = new ArrayList();
            string sql = "select * from car where Cnum='" + Session["Cnum"] + "'";
            SqlDataReader dr = null;
            SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);
            try
            {
                dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql);
                if (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        ary.Add(dr[i].ToString().Trim());
                    }
                }
                else
                {
                     for(int K=0;K<15;K++)
                    {
                        ary.Add("");
                    }
                }
            }
            catch
            {
                for (int K = 0; K < 15; K++)
                {
                    ary.Add("");
                }
            }
            finally
            {
                dr.Close();
            }
            return ary.ToArray();
        }

    public object[] GetDP_info()//汽车底盘信息
        {
            ArrayList ary = new ArrayList();
            string sql = "select * from car where Cnum='" + Session["Cnum"] + "'";
            SqlDataReader dr = null;
            SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);
            try
            {
                dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql);
                if (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        ary.Add(dr[i].ToString().Trim());
                    }
                }
                else
                {
                      for(int K=0;K<15;K++)
                    {
                        ary.Add("");
                    }
                }
            }
            catch
            {
                for (int K = 0; K < 15; K++)
                {
                    ary.Add("");
                }
            }
            finally
            {
                dr.Close();
            }
            return ary.ToArray();
        }

    public object[] GetXS_Info()//汽车行驶信息
        {
            ArrayList ary = new ArrayList();
            string sql = "select * from car where Cnum='" + Session["Cnum"] + "'";
            SqlDataReader dr = null;
            SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);
            try
            {
                dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql);
                if (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        ary.Add(dr[i].ToString().Trim());
                    }
                }
                else
                {
                      for(int K=0;K<15;K++)
                    {
                        ary.Add("");
                    }
                }
            }
            catch
            {
                for (int K = 0; K < 15; K++)
                {
                    ary.Add("");
                }
            }
            finally
            {
                dr.Close();
            }
            return ary.ToArray();
        }
}
